import { httpGet, httpPost } from "@/utils/request";
import Taro from '@tarojs/taro'
//订单列表
export const fetchUserOrder = (data, fn) => {
  return httpGet({
    url: "/user/order/listUserOrder",
    data: data,
  });
};
//获取购买订单详情
export const fetchUserBuyGoodsDetail = (data = {}, fn) => {
  return httpGet({
    url: "/user/goods/getUserBuyGoodsDetail",
    data: data,
  });
};

//获取课程列表
export const fetchtListUserGoods = (data = {}, fn) => {
  return httpGet({
    url: "/user/order/listUserGoods",
    data: data,
  });
};

//获取奖品列表
export function fetchMyPrize(data) {
  return httpGet({
    url: "/goods/lottery/listMyPrize",
    data: data,
  });
}

//领取奖品
export function fakeReceivePrize(data) {
  return httpPost({
    url: "/goods/lottery/receivePrize",
    data: data,
  });
}

//获取用户打包商品
export function fetchUserGoodsPackage(data) {
  return httpGet({
    url: "/user/order/listUserGoodsPackage",
    data: data,
  });
}

//领取奖品
export function fakeChoosePackage(data) {
  return httpPost({
    url: "/user/order/choosePackage",
    data: data,
  });
}

//获取支付订单详情
export function fetchGoodsBuyPageInfo(data) {
  return httpGet({
    url: "/user/goods/getGoodsBuyPageInfo",
    data: data,
  });
}

//获取问卷信息
export function fetchUserNeedInformationCollection(data) {
  return httpGet({
    url: "/marketing/informationCollection/checkUserNeedInformationCollection",
    data: data,
  });
}
//获取支付详情
export function fetchOrderDetail(data) {
  return httpGet({
    url: "/user/order/getOrderDetail",
    data: data,
  });
}

//获取支付价格
export function fakeCalculateOrderPrice(data) {
  return httpPost({
    url: "/user/order/calculateOrderPrice",
    data: data,
  });
}

//下单
export function fakeSubmitOrder(data) {
  return httpPost({
    url: "/user/order/submitOrder",
    data: data,
  });
}

//下单信息
export function fakeWechatPayInfo(data) {
  return httpPost({
    url: "/pay/wechat/getWechatPayInfo",
    data: data,
  });
}

//下单追问
export function fakeSubmitPrePaymentOrder(data) {
  const shareData = Taro.getStorageSync("shareInfo") || {};
  return httpPost({
    url: "/user/order/submitPrePaymentOrder",
    data: {
      ...shareData,
      ...data,
    },
  });
}

//获取支付详情
export function fetchPrePaymentOrderWechatPayInfo(data) {
  return httpPost({
    url: "/pay/wechat/getPrePaymentOrderWechatPayInfo",
    data: data,
  });
}
